<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../libs/system.js"></script>
    <script>
        System.import('../libs/cc.js');
    </script>
    <script>
        function mapValue(x, a, b, c, d) {
            return (x - a) * (d - c) / (b - a) + c;
        }

        function calF1(z,n,f){
            return (-1/z - 1/n) / (1/f - 1/n);
        }

        function calF2(f1){
            return 2 * f1 - 1;
        }

        window.onload = function () {
            const n = 0.1;
            const f = 100;

            // let z = mapValue(-(f+n)/2,-n,-f,-1,1);
            // console.log(z);

            // let z = mapValue(0.95,0,1,-1/n,-1/f);
            // console.log(z,1/z);
            //
            // let z1 = mapValue(-1/((n + f)/2),-1/n,-1/f,-1,1);
            // console.log('z1:',z1);
            // console.log('1/z1:',1/z1);

            let z = -4;
            let f2 = calF2(calF1(z,n,f));
            console.log(f2);
        };
    </script>
</head>
<body>

</body>
</html>
